package com.rem.se.reflect;

/**
 * @author Rem
 * @date 2021-03-14
 */

public class Demo05 {

    public static void main(String[] args) throws ClassNotFoundException {
        System.out.println("========获取系统的类加载=========");
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        //sun.misc.Launcher$AppClassLoader@18b4aac2
        System.out.println(systemClassLoader);


        System.out.println("========获取系统加载器的父类加载器--->扩展类加载器=========");
        ClassLoader parent = systemClassLoader.getParent();
        //sun.misc.Launcher$ExtClassLoader@7ea987ac
        System.out.println(parent);


        System.out.println("========获取扩展类加载器的父类加载器-->根加载器（用C/C++写的)  获取不到=========");
        ClassLoader grandParent = parent.getParent();
        //null
        System.out.println(grandParent);


        System.out.println("========当前类是哪个类加载器加载的=========");
        ClassLoader classLoader = Class.forName("com.rem.se.reflect.Demo05").getClassLoader();
        //sun.misc.Launcher$AppClassLoader@18b4aac2
        System.out.println(classLoader);


        System.out.println("========测试JDK内部类谁加载的--->是由根加载器加载的，所以打印不出来=========");
        classLoader = Class.forName("java.lang.Object").getClassLoader();
        //null
        System.out.println(classLoader);


        System.out.println("========获取系统类加载器可以加载的路径=========");
        /**
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\charsets.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\deploy.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-64.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\javaws.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\jce.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\jfr.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\jsse.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\management-agent.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\plugin.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\resources.jar;
         * D:\Program Files\Java\jdk1.8.0_131\jre\lib\rt.jar;F:\project\rem_project\se\target\classes;
         * E:\RepMaven\org\projectlombok\lombok\1.18.18\lombok-1.18.18.jar;
         * E:\RepMaven\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;
         * E:\RepMaven\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;
         * E:\RepMaven\cn\hutool\hutool-all\5.4.0\hutool-all-5.4.0.jar;
         * E:\RepMaven\org\apache\commons\commons-lang3\3.10\commons-lang3-3.10.jar;
         * D:\Program Files\JetBrains\IntelliJ IDEA 2019.3.1\lib\idea_rt.jar
         */
        System.out.println(System.getProperty("java.class.path"));


    }


}
